var RoleTable = {
    id: "roleTable",//表格id
    seItem: null,		//选中的条目
    me : ""
};


/**
 * 初始化整个表格
 */
RoleTable.init = function(){
    var defaultColunms = this.initColumn();
    var bstable = new BSTable(RoleTable.id,Feng.ctxPath+"/role/allParam",defaultColunms);
    bstable.setData({});
    this.me = bstable.init();
};

/**
 * 初始化表格的列
 */
RoleTable.initColumn = function(){
    var columns = [
        {title: '序号',align: 'center',valign: 'middle',
            formatter: function indexFormatter(value, row, index) {//在表格前加上序号
                return index+1;
            }},
        {title: '角色名称',field: 'roleName',align: 'center',valign: 'middle'},
        {title: '角色权限',field: 'describe',align: 'center',valign: 'middle'},
        {title: '创建时间',field: 'createDate',align: 'center',valign: 'middle'},
        ];
    return columns;
};

/**
 * 点击搜索按钮
 * @returns
 */
function clickSearch(){
    var queryData = {};
    var val_search_roleName = $("#txt_search_roleName").val();
    var val_search_roleCode = $("#txt_search_roleCode").val();

    if (val_search_roleName != "" || val_search_roleName != null){
        queryData['roleName'] =  val_search_roleName;
    }

    if (val_search_roleCode != "" || val_search_roleCode != null){
        queryData['roleCode'] =  val_search_roleCode;
    }

    RoleTable.me.destroy(queryData);
    //RoleTable.me.refresh({query: queryData});
}

$(function(){
    //初始化用户管理表格
    RoleTable.init();

});
